package com.ruoyi.web.controller.app;

import com.ruoyi.order.domain.app.Vo.ProductViewVo;
import com.ruoyi.order.domain.app.Vo.ProductResultVo;
import com.ruoyi.order.service.IHotProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author 陈焕然
 * @version 1.0
 */
@Controller
@RequestMapping("/app")

public class HotProductAppContrllor {

    @Autowired
    private IHotProductService hotProductService;


    @RequestMapping("/prod/prodListByTagId")
    @ResponseBody
    public ProductResultVo getPopularRecommendation(Integer tagId,Integer size){
        ProductResultVo resultList = new ProductResultVo();
        List<ProductViewVo> list = hotProductService.getPopularRecommendation();
        if (list !=null && list.size() > 0 ){
            resultList.setRecords(list);
            resultList.setTotal(list.size());
        }else{
            resultList.setTotal(0);
        }
        resultList.setCurrent(10);
        resultList.setSize(size);
        resultList.setPages(2);
        resultList.setOptimizeCountSql(true);
        resultList.setSearchCount(true);
        resultList.setMaxLimit(null);
        return resultList;
    }
}
